#ifndef _DEV_FACTROY_H_
#define _DEV_FACTROY_H_

#include "scsi_dev.h"
#include "serial_file_base.h"
#include <map>
#include <string>

using namespace std;

#ifdef _USRDLL
class __declspec(dllexport) CDevFlyWeightFactory
#else
class CDevFlyWeightFactory
#endif
{
public:
	CDevFlyWeightFactory() {m_mapScsiDev.clear();}
	int AutoScan();
	int DelScsiDev(const char * devName);
	int Clear();
	CDisk_Dev* CreateScsiDev(const char * devName,bool bReCheck = false);
	int GetDevText(char * deviceText,char * devName);
	int DelDevText(char * devName);
	int CloseDeviceFd(char * devName);
	int GetDevNum()
	{
		return (int)m_mapScsiDev.size();
	}

protected:

	map<string, CDisk_Dev*> m_mapScsiDev;
	map<string,string>	  m_mapDeviceText;

	CCross_Lock m_lock;
};

#ifdef _USRDLL
class __declspec(dllexport) CSerialFileFactory
#else
class CSerialFileFactory
#endif
{
public:
	CSerialFileFactory() {;}
	CSerialFileBase * CreateSerialFile(const char * diskPath);
	
protected:
	CCross_Lock m_lock;
};

extern  CDevFlyWeightFactory g_scsiDevFac;
extern  CSerialFileFactory   g_serialFileFac;

#endif	//_DEV_FACTROY_H_
